package singleton;

public class ResourceManager {
    private static ResourceManager instance;
    private static int resourceCounter = 0;
    private ResourceManager() {}

    // 单例对象（懒汉式）
    public static synchronized ResourceManager getInstance() {
        if (instance == null) {
            instance = new ResourceManager();
        }
        return instance;
    }
    public int getResource() {
        return ++resourceCounter;
    }
}
